<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=undefined"
    />
    <link rel="stylesheet" href="./css/output.css" />
    <link rel="stylesheet" href="./css/补充.css" />
    <title>草蟒中文编程 - Python中文版</title>
    <style>
      .下拉菜单:hover .下拉菜单-内容 {
        display: block;
      }
    </style>
  </head>
  <body class="">
    <div class="粘性 上-0">
      <ul
        class="高-[40px] 弹性盒 左右对齐内容-居中 文本-岩板-300 文本-xl 字体-粗 背景-天蓝-500"
      >
        <li class="行间距-[40px] 外右-4 悬停:文本-岩板-100">
          <a href="index.html">下载安装</a>
        </li>
        <li class="行间距-[40px] 外右-4 文本-白 相对 下拉菜单">
          <a href="grasspy.html" class="">草蟒指南</a>
          <div
            class="绝对 z-1 背景-白 字体-正常 文本-岩板-600 边框 圆角 隐藏 宽-36 下拉菜单-内容"
          >
            <a href="grasspy_kw.html" class="块 悬停:背景-天蓝-400">保留字</a>
            <a href="grasspy_btinfunc.html" class="块 悬停:背景-天蓝-400"
              >内置函数</a
            >
            <a href="grasspy_exception.html" class="块 悬停:背景-天蓝-400"
              >内置异常类</a
            >
            <a href="javascript:void(0);" class="块 悬停:背景-天蓝-400"
              >魔术属性和方法</a
            >
            <a href="grasspy_han_std.html" class="块 悬停:背景-天蓝-400"
              >已汉化标准库</a
            >
            <a href="grasspy_han_third.html" class="块 悬停:背景-天蓝-400"
              >已汉化第三方库</a
            >
          </div>
        </li>
        <li class="行间距-[40px] 外右-4 悬停:文本-岩板-100 相对 下拉菜单">
          <a href="jsweb.html">极速Web</a>
          <div
            class="绝对 z-1 背景-白 字体-正常 文本-岩板-600 边框 圆角 隐藏 宽-36 下拉菜单-内容"
          >
            <a href="jsweb_html_tag.html" class="块 悬停:背景-天蓝-400"
              >中文HTML</a
            >
            <a href="jsweb_css_prop.html" class="块 悬停:背景-天蓝-400"
              >中文CSS</a
            >
            <a href="jsweb_jsts_kw.html" class="块 悬停:背景-天蓝-400"
              >中文JS/TS</a
            >
          </div>
        </li>
        <li class="行间距-[40px] 外右-4 悬停:文本-岩板-100">
          <a href="ccpp.html">中文C/C++</a>
        </li>
        <li class="行间距-[40px] 外右-4 悬停:文本-岩板-100">
          <a href="articles.html">存档文章</a>
        </li>
        <li class="行间距-[40px] 悬停:文本-岩板-100">
          <a href="contact.html">联系我们</a>
        </li>
      </ul>
    </div>

    <div
      class="背景-岩板-50 最小高度-[1200px] 外下-4 大:宽-[1024px] 中:宽-全 小:宽-全 外-自动 文本-居中"
    >
      <p class="文本-蓝-600 内上-12 内下-4 文本-大 字体-粗">魔术属性和方法</p>
      <p class="文本-绿-600 内下-4 文本-左 内x-4 外x-自动">
        形如 __xxx__ 的内置属性或方法称为魔术属性或方法。为了尽量不更改 CPython
        的原始实现，大部分魔术属性/方法汉化是通过在词法解析阶段（tokenizer.c）将中文替换为英文实现的，
        而在 C
        语言中，为了避免内存溢出，被替换的字符串（中文）的字节数须大于替换字符串（英文）的字节数。
        因此，在必要的时候加下划线是比较自然的解决办法。这样的情况非常之少。
      </p>
      <p><strong>按汉字个数和下划线数量分组</strong></p>
      <br />
      <div>
        <p style="color: blue">
          第一组：一个汉字，前后都有<span style="color: red">三</span>个短下划线
        </p>
        <br />
        <table>
          <tr>
            <td>___长___</td>
            <td class="右边框">__len__</td>
            <td>___串___</td>
            <td class="右边框">__str__</td>
            <td>___删___</td>
            <td>__del__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">
          第二组：两个汉字，前后都有<span style="color: red">三</span>个短下划线
        </p>
        <br />
        <table>
          <tr>
            <td>___删除___</td>
            <td class="右边框">__delete__</td>
            <td>___商余___</td>
            <td>__divmod__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第三组：一个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__类__</td>
            <td>__class__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第四组：两个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__文档__</td>
            <td class="右边框">__doc__</td>
            <td>__字典__</td>
            <td>__dict__</td>
          </tr>
          <tr>
            <td>__新建__</td>
            <td class="右边框">__new__</td>
            <td>__相等__</td>
            <td>__eq__</td>
          </tr>
          <tr>
            <td>__表示__</td>
            <td class="右边框">__repr__</td>
            <td>__不等__</td>
            <td>__ne__</td>
          </tr>
          <tr>
            <td>__哈希__</td>
            <td class="右边框">__hash__</td>
            <td>__函数__</td>
            <td>__func__</td>
          </tr>
          <tr>
            <td>__获取__</td>
            <td class="右边框">__get__</td>
            <td>__截断__</td>
            <td>__trunc__</td>
          </tr>
          <tr>
            <td>__名称__</td>
            <td class="右边框">__name__</td>
            <td>__调用__</td>
            <td>__call__</td>
          </tr>
          <tr>
            <td>__基类__</td>
            <td class="右边框">__base__</td>
            <td>__注解__</td>
            <td>__annotations__</td>
          </tr>
          <tr>
            <td>__加法__</td>
            <td class="右边框">__add__</td>
            <td>__减法__</td>
            <td>__sub__</td>
          </tr>
          <tr>
            <td>__乘法__</td>
            <td class="右边框">__mul__</td>
            <td>__取模__</td>
            <td>__mod__</td>
          </tr>
          <tr>
            <td>__右加__</td>
            <td class="右边框">__radd__</td>
            <td>__右减__</td>
            <td>__rsub__</td>
          </tr>
          <tr>
            <td>__右乘__</td>
            <td class="右边框">__rmul__</td>
            <td>__右模__</td>
            <td>__rmod__</td>
          </tr>
          <tr>
            <td>__乘方__</td>
            <td class="右边框">__pow__</td>
            <td>__异或__</td>
            <td>__xor__</td>
          </tr>
          <tr>
            <td>__右与__</td>
            <td class="右边框">__rand__</td>
            <td>__右或__</td>
            <td>__ror__</td>
          </tr>
          <tr>
            <td>__复数__</td>
            <td class="右边框">__complex__</td>
            <td>__反转__</td>
            <td>__reversed__</td>
          </tr>
          <tr>
            <td>__负号__</td>
            <td class="右边框">__neg__</td>
            <td>__正号__</td>
            <td>__pos__</td>
          </tr>
          <tr>
            <td>__舍入__</td>
            <td class="右边框">__round__</td>
            <td>__模块__</td>
            <td>__module__</td>
          </tr>
          <tr>
            <td>__小于__</td>
            <td class="右边框">__lt__</td>
            <td>__小等__</td>
            <td>__le__</td>
          </tr>
          <tr>
            <td>__大于__</td>
            <td class="右边框">__gt__</td>
            <td>__大等__</td>
            <td>__ge__</td>
          </tr>
          <tr>
            <td>__整数__</td>
            <td class="右边框">__int__</td>
            <td>__布尔__</td>
            <td>__bool__</td>
          </tr>
          <tr>
            <td>__索引__</td>
            <td class="右边框">__index__</td>
            <td>__迭代__</td>
            <td>__iter__</td>
          </tr>
          <tr>
            <td>__自加__</td>
            <td class="右边框">__iadd__</td>
            <td>__自减__</td>
            <td>__isub__</td>
          </tr>
          <tr>
            <td>__自乘__</td>
            <td class="右边框">__imul__</td>
            <td>__设置__</td>
            <td>__set__</td>
          </tr>
          <tr>
            <td>__自与__</td>
            <td class="右边框">__iand__</td>
            <td>__自或__</td>
            <td>__ior__</td>
          </tr>
          <tr>
            <td>__进入__</td>
            <td class="右边框">__enter__</td>
            <td>__退出__</td>
            <td>__exit__</td>
          </tr>
          <tr>
            <td>__全部__</td>
            <td class="右边框">__all__</td>
            <td>__文件__</td>
            <td>__file__</td>
          </tr>
          <tr>
            <td>__路径__</td>
            <td class="右边框">__path__</td>
            <td>__复制__</td>
            <td>__copy__</td>
          </tr>
          <tr>
            <td>__等待__</td>
            <td class="右边框">__await__</td>
            <td>__缺失__</td>
            <td>__missing__</td>
          </tr>
          <tr>
            <td>__自身__</td>
            <td class="右边框">__self__</td>
            <td>__归并__</td>
            <td>__reduce__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第五组：三个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__初始化__</td>
            <td class="右边框">__init__</td>
            <td>__属性槽__</td>
            <td>__slots__</td>
          </tr>
          <tr>
            <td>__设属性__</td>
            <td class="右边框">__setattr__</td>
            <td>__格式化__</td>
            <td>__format__</td>
          </tr>
          <tr>
            <td>__删属性__</td>
            <td class="右边框">__delattr__</td>
            <td>__限定名__</td>
            <td>__qualname__</td>
          </tr>
          <tr>
            <td>__下一个__</td>
            <td class="右边框">__next__</td>
            <td>__异退出__</td>
            <td>__aexit__</td>
          </tr>
          <tr>
            <td>__下整除__</td>
            <td class="右边框">__floordiv__</td>
            <td>__真除法__</td>
            <td>__truediv__</td>
          </tr>
          <tr>
            <td>__右真除__</td>
            <td class="右边框">__rtruediv__</td>
            <td>__右商余__</td>
            <td>__rdivmod__</td>
          </tr>
          <tr>
            <td>__右乘方__</td>
            <td class="右边框">__rpow__</td>
            <td>__与运算__</td>
            <td>__and__</td>
          </tr>
          <tr>
            <td>__深拷贝__</td>
            <td class="右边框">__deepcopy__</td>
            <td>__或运算__</td>
            <td>__or__</td>
          </tr>
          <tr>
            <td>__矩阵乘__</td>
            <td class="右边框">__matmul__</td>
            <td>__右异或__</td>
            <td>__rxor__</td>
          </tr>
          <tr>
            <td>__左移位__</td>
            <td class="右边框">__lshift__</td>
            <td>__右移位__</td>
            <td>__rshift__</td>
          </tr>
          <tr>
            <td>__逆运算__</td>
            <td class="右边框">__invert__</td>
            <td>__浮点数__</td>
            <td>__float__</td>
          </tr>
          <tr>
            <td>__异迭代__</td>
            <td class="右边框">__aiter__</td>
            <td>__所在包__</td>
            <td>__package__</td>
          </tr>
          <tr>
            <td>__绝对值__</td>
            <td class="右边框">__abs__</td>
            <td>__在其中__</td>
            <td>__contains__</td>
          </tr>
          <tr>
            <td>__取元素__</td>
            <td class="右边框">__getitem__</td>
            <td>__设元素__</td>
            <td>__setitem__</td>
          </tr>
          <tr>
            <td>__删元素__</td>
            <td class="右边框">__delitem__</td>
            <td>__自异或__</td>
            <td>__ixor__</td>
          </tr>
          <tr>
            <td>__异进入__</td>
            <td class="右边框">__aenter__</td>
            <td>__设状态__</td>
            <td>__setstate__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第六组：四个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__内存占用__</td>
            <td class="右边框">__sizeof__</td>
            <td>__所有子类__</td>
            <td>__subclasses__</td>
          </tr>
          <tr>
            <td>__右下整除__</td>
            <td class="右边框">__rfloordiv__</td>
            <td>__右右移位__</td>
            <td>__rrshift__</td>
          </tr>
          <tr>
            <td>__异下一个__</td>
            <td class="右边框">__anext__</td>
            <td>__右左移位__</td>
            <td>__rlshift__</td>
          </tr>
          <tr>
            <td>__自左移位__</td>
            <td class="右边框">__ilshift__</td>
            <td>__自右移位__</td>
            <td>__irshift__</td>
          </tr>
          <tr>
            <td>__自下整除__</td>
            <td class="右边框">__ifloordiv__</td>
            <td>__所有基类__</td>
            <td>__bases__</td>
          </tr>
          <tr>
            <td>__右矩阵乘__</td>
            <td class="右边框">__rmatmul__</td>
            <td>__自矩阵乘__</td>
            <td>__imatmul__</td>
          </tr>
          <tr>
            <td>__长度提示__</td>
            <td class="右边框">__length_hint__</td>
            <td></td>
            <td></td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第七组：五个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__取对象属性__</td>
            <td>__getattribute__</td>
          </tr>
          <tr>
            <td>__建命名空间__</td>
            <td>__prepare__</td>
          </tr>
          <tr>
            <td>__初始化子类__</td>
            <td>__init_subclass__</td>
          </tr>
          <tr>
            <td>__取新建参数__</td>
            <td>__getnewargs__</td>
          </tr>
          <tr>
            <td>__是抽象方法__</td>
            <td>__isabstractmethod__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第八组：六个汉字，前后都是正常的两个短下划线</p>
        <br />
        <table>
          <tr>
            <td>__检查是否子类__</td>
            <td>__subclasscheck__</td>
          </tr>
          <tr>
            <td>__检查是否实例__</td>
            <td>__instancecheck__</td>
          </tr>
        </table>
        <br />
        <br />
        <p style="color: blue">第九组：其他</p>
        <br />
        <table>
          <tr>
            <td>__归并ex__</td>
            <td>__reduce_ex__</td>
          </tr>
        </table>
        <br />
        <br />
      </div>
    </div>

    <div class="文本-居中 背景-[#FF0000]">
      <p
        class="内y-2 文本-白 大:文本-4xl 中:文本-2xl 小:文本-xl 字体-超粗 字间距-[.25em]"
      >
        只要中文长在，必然汉魂不朽
      </p>
      <hr />
      <p class="文本-黄-200">
        &copy; 版权所有 2019-202X 草蟒极速中文编程
        <a href="https://beian.miit.gov.cn" target="_blank"
          >浙ICP备19052431号-1</a
        >
      </p>
    </div>
  </body>
</html>
